package com.llstudio.jpa.entity;

import static java.util.Arrays.stream;

public enum Gender {
    MALE("M"),
    FEMALE("F");

    private final String value;

    Gender(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static Gender of(String value) {
        return stream(values())
                .filter(it -> it.getValue().equals(value))
                .findFirst()
                .orElseThrow(IllegalArgumentException::new);
    }
}
